package com.enlorenz.core.channel.socket.common.writer;

import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;

/**
 * 加入长度的写出者
 * @author MAC
 */
public class LengthAppendNioWriter extends AbstractLengthAppendWriter implements INioWriter{
	private SocketChannel channel;

	@Override
	protected void writeHeadMsg(byte[] fullData) throws Exception{
		ByteBuffer bb=ByteBuffer.wrap(fullData);
		channel.write(bb);
		channel.socket().getOutputStream().flush();
	}
	
	public void setChannel(SocketChannel channel) {
		this.channel = channel;
	}


	@Override
	public void setSocketChannel(SocketChannel channel) {
		this.channel=channel;
	}

}
